load("@rules_license//rules:license.bzl", "license")

package(
    default_applicable_licenses = [":package_license"],
    default_visibility = ["//visibility:public"],
)

license(
    name = "package_license",
    package_name = "etherlab-ethercat",
)

# GNU General Public License
licenses(["restricted"])

exports_files(["LICENSE"])

# Userspace library to communicate with the EtherCAT host.
# The kernel-space module is not imported into bcr as it
# needs to be compiled and installed on each computer separately.
cc_library(
    name = "ethercat_lib",
    srcs = glob(
        [
            "lib/*.h",
            "lib/*.c",
        ],
    ) + [
        "config.h",  # Autogenerated.
        "globals.h",
        "master/globals.h",
        "master/ioctl.h",
    ],
    hdrs = [
        "include/ecrt.h",
    ],
    copts = ["-I./"],
    alwayslink = True,
)
